package com.cuijq.ms.chaindesign.v5;

import java.util.ArrayList;
import java.util.List;
import javax.swing.text.AbstractDocument.Content;

/**
 * @author by CuiJQ
 * @Classname SensitiveWordFilterChain
 * @Description SensitiveWordFilterChain Description
 * @Date 2021/5/29 11:08
 */
public class SensitiveWordFilterChain {

  private List<SensitiveWordFilter> filters = new ArrayList<>();

  public void addFilter(SensitiveWordFilter filter) {
    this.filters.add(filter);
  } // return true if content doesn't contain sensitive words.

  public boolean filter(Content content) {
    for (SensitiveWordFilter filter : filters) {
      if (!filter.doFilter(content)) {
        return false;
      }
    }
    return true;
  }
}
